/* ====================================================================
 * (#)Header: Dao.java
 * (#)Revision: 
 * (#)Date Created: Mar 3, 2007 2:07:44 AM
 * (#)Created By: Karol Wozniak
 * ====================================================================
 *
 * Copyright (c) 2007 karolak .  All rights reserved.
 *
 * ====================================================================
 * 
 * The software application represented here is the sole property of 
 * karolak. Its unauthorized utilization is expressly prohibited.
 * 
 * ====================================================================
 */

package com.karolak.dao;

import java.util.List;
import java.util.Map;

import com.karolak.query.Criterias;


/**
 * 
 * <code>Dao</code> is ....
 * 
 * @author <a href="mailto:kwozniak@hotmail.com">Karol Wozniak</a>
 */
public interface Dao {

	// === finders === //
	public <T, Id> T findById(Class<T> clazz, Id id);
	public <T> T find(Class<T> clazz, Criterias criterias);
	public <T> T find(String queryName, Map<String, Object> paramMap);

	// === crud === //
	public <T> T persist(T entity);
	public <T> T merge(T entity);
	public <T> void remove(T entity);
	public <T, Id> void remove(Class<T> clazz, Id id);

	// === selectors === //
	public <T> List<T> select(Class<T> clazz);
	public <T> List<T> select(Class<T> clazz, Criterias criterias);
	public <T> List<T> select(String queryName, Map<String, Object> paramMap);

	// === range selectors === //
	public <T> List<T> select(Class<T> clazz, int startPosition, int maxResult);
	public <T> List<T> select(Class<T> clazz, Criterias criterias, int startPosition, int maxResult);
	public <T> List<T> select(String queryName, Map<String, Object> paramMap, int startPosition, int maxResult);

	// === count selectors === //
	public <T> int selectCount(Class<T> clazz);
	public <T> int selectCount(Class<T> clazz, Criterias criterias);
	public int selectCount(String queryName, Map<String, Object> paramMap);
}
